<?php

namespace app\admin\model\official;

use traits\model\SoftDelete;

class OfficialListDownload extends BaseModel
{

    use SoftDelete;


    // 表名
    protected $name = 'official_list_download';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [
        'language_text'
    ];


    public function getLanguageList()
    {
        return ['1' => __('Language 1'), '2' => __('Language 2')];
    }


    public function getLanguageTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['language']) ? $data['language'] : '');
        $list = $this->getLanguageList();
        return isset($list[$value]) ? $list[$value] : '';
    }


}
